package no.hio.wsclient;


import java.util.List;

import junit.framework.TestCase;
import no.hio.wsproviderproduct.Product;
import no.hio.wsproviderproduct.ProductService;
import no.hio.wsproviderproduct.ProductServiceImplService;

import org.junit.Before;
import org.junit.Test;
/**
 * Tests if web-service is available
 * @author andreas
 *
 */
public class ProductServiceTestCase extends TestCase{
	ProductService service;
	
	@Before
	public void setUp() throws Exception {
		ProductServiceImplService  impl = new ProductServiceImplService();
		service = (ProductService) impl.getProductServicePort();
	}
	
	@Test
	public void testFindAllProducts(){
		
		List<Product> plist;
		plist = service.findAllProducts();
		plist = null;

	}
	
	@Test
	public void testFindByProductID()
	{
		List<Product> plist;
		plist = service.findAllProducts();
		Product p = plist.get(0);
		Product n = service.findByProductID(p.getProductID());
		assertEquals(p.getProductID(), n.getProductID());
		n = p = null;
		plist = null;
	}

}
